<script>
    $(document).ready(function () {
        $('.asyncdatapdf').click(function () {
            var id = $(this).attr('id');
            var key = {
                m_nombre_en_disco: id
            };
            console.log('mensaje: id ' + id);
            $.ajax({
                url: "<?= base_url('xpanel/saveDataViewPDF') ?>",
                type: 'POST',
                data: key,
                success: function (msg) {
                    window.location.href = "<?= base_url('xpanel/viewPDF.mti') ?>";
                }
            });
        });
        $('.asyncdatatest').click(function () {
            var id = $(this).attr('id');
            var key = {
                m_material_id: id
            };
            $.ajax({
                url: "<?= base_url('xpanel/saveDataGenTest') ?>",
                type: 'POST',
                data: key,
                success: function (msg) {
                    window.location.href = "<?= base_url('xpanel/genTest.mti') ?>";
                }
            });
        });
        $('.donetest').click(function(){
            $.ajax({
                url: "<?= base_url('xpanel/c') ?>",
                type: 'POST'
            });
        });    
    });
</script>
<!-- Content -->
<div id="content">

    <!-- Content wrapper -->
    <div class="wrapper">

        <!-- Breadcrumbs line -->
        <div class="crumbs">
            <ul id="breadcrumbs" class="breadcrumb"> 
                <li><a href="<?= base_url('xpanel') ?>">XPANEL</a></li>
            </ul>
        </div>
        <!-- /breadcrumbs line -->

        <!-- Page header -->
        <div class="page-header">
            <div class="page-title"></div>
        </div>
        <!-- /page header -->

        <!-- Inside tabs -->
        <div class="widget navbar-tabs table-tabs">
            <div class="navbar">
                <div class="navbar-inner">
                    <h6>Inside tabs</h6>
                    <ul class="nav nav-tabs pull-right">
                        <li class="active"><a href="#table-tab" data-toggle="tab">Materiales</a></li>
                        <li><a href="#table-tab2" data-toggle="tab">Examenes</a></li>
                    </ul>
                </div>
            </div>
            <div class="tabbable">
                <div class="tab-content">
                    <div class="tab-pane active" id="table-tab">
                        <div class="table-overflow">
                            <table class="table table-striped table-hover">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Material</th>
                                        <th>Vista</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php foreach ($lista_materiales as $n => $m) { ?>
                                    <tr>
                                        <td><?=$n+1?></td>
                                        <td>+ <?= $m->m_titulo ?></td>
                                        <td><a href="#" class="asyncdatapdf" id="<?= $m->m_nombre_en_disco ?>"><i class="icon-certificate"></i></a></td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="tab-pane" id="table-tab2">
                        <div class="table-overflow">
                            <table class="table table-hover table-bordered">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Módulo</th>
                                        <th>Sub-Módulo</th>
                                        <th>Material</th>
                                        <th>Estado</th>
                                        <th>Min. Aprobatorio</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php foreach ($statusTest as $n => $t) { ?>
                                    <tr>
                                        <td><?=$n+1?></td>
                                        <td>+ <?= $t->m_nombre ?></td>
                                        <td><?= $t->sm_nombre ?> </td>
                                        <td><?= $t->m_titulo ?> </td>
                                        <td>
                                        <?php if($t->estado=='Permitir'){?>
                                            <a href="#" class="asyncdatatest" id="<?= $t->m_material_id ?>"><i class="icon-key"></i></a>
                                        <?php }else{ ?>
                                            <i class="icon-lock"></i>
                                        <?php } ?> 
                                        </td>
                                        <td><?= $t->m_minimo ?> </td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /inside tabs -->
    </div>
    <!-- /content wrapper -->
</div>
<!-- /content -->